package com.hex.ds.hdrs.security;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.servlet.Filter;


@Configuration
public class XssFilterConfig {

    @Bean
    public FilterRegistrationBean filterRegistrationBean() {
        FilterRegistrationBean registration = new FilterRegistrationBean();
        registration.setFilter(xssFilter());
        registration.addUrlPatterns("/*");
        registration.addInitParameter("paramName", "paramValue");
        registration.setName("xssFilter");
        return registration;
    }

    /**
     * @Method: xssFilter <br>
     * @Param: [] <br>
     * @Return: javax.servlet.Filter <br>
     * @Description：创建一个bean<br>
     * @Author： gc.zuo<br>
     * @Date： 2021/6/18 17:28 <br>
     * @Version： V1.0<br>
     */
    @Bean(name = "xssFilter")
    public Filter xssFilter() {
        return new XssFilter();
    }

}